package cn.net.zidian.util;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.widget.TextView;

import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.content.ContextCompat;
import com.hjq.bar.style.LightBarStyle;

import cn.net.zidian.R;

public final class TitleBarStyle extends LightBarStyle {

    @Override
    public TextView newTitleView(Context context) {
        return new AppCompatTextView(context);
    }

    @Override
    public TextView newLeftView(Context context) {
        return new AppCompatTextView(context);
    }

    @Override
    public TextView newRightView(Context context) {
        return new AppCompatTextView(context);
    }

    @Override
    public Drawable getTitleBarBackground(Context context) {
        return new ColorDrawable(ContextCompat.getColor(context, R.color.white));
    }

    @Override
    public Drawable getBackButtonDrawable(Context context) {
        return ContextCompat.getDrawable(context, R.drawable.left);
    }

    @Override
    public ColorStateList getTitleColor(Context context) {
        return ColorStateList.valueOf(0xFF000000);
    }
    @Override
    public Drawable getLeftTitleBackground(Context context) {
        return null;
    }

    @Override
    public Drawable getRightTitleBackground(Context context) {
        return null;
    }

    public int getChildHorizontalPadding(Context context) {
        return (int) context.getResources().getDimension(R.dimen.dp_12);
    }

    @Override
    public int getChildVerticalPadding(Context context) {
        return (int) context.getResources().getDimension(R.dimen.dp_14);
    }

    @Override
    public float getTitleSize(Context context) {
        return context.getResources().getDimension(R.dimen.sp_15);
    }

    @Override
    public float getLeftTitleSize(Context context) {
        return context.getResources().getDimension(R.dimen.sp_13);
    }

    @Override
    public float getRightTitleSize(Context context) {
        return context.getResources().getDimension(R.dimen.sp_13);
    }

    @Override
    public int getTitleIconPadding(Context context) {
        return (int) context.getResources().getDimension(R.dimen.dp_2);
    }

    @Override
    public int getLeftIconPadding(Context context) {
        return (int) context.getResources().getDimension(R.dimen.dp_2);
    }

    @Override
    public int getRightIconPadding(Context context) {
        return (int) context.getResources().getDimension(R.dimen.dp_2);
    }

    @Override
    public ColorStateList getRightTitleColor(Context context) {
        return ColorStateList.valueOf(0xFF000000);
    }
}